package com.ruozedata.bigdata.lesson03

import scala.beans.BeanProperty

object SimpleObject {

    def main(args: Array[String]): Unit = {

        val user = new User()
        user.name = "PK"
        user.name_$eq("pk30")  // 底层调用set方法
        println(s"${user.name}....")

        user.eat()
        user.watchGame("xxxx")

        // user.printWatch

    }
}

class User {

    // 定义属性
    @BeanProperty
    val age:Int = 0

    var name:String = _  // _ 是一个占位符 在使用时注意：var修饰

    // 定义属性
    def eat(): Unit = {
        println(s"$name.....eating.......")
    }

    def watchGame(gameName:String): Unit = {
        println(s"$name.....$gameName....")
    }

    private def printWatch(): Unit = {
        println(".....")
    }
}
